Some exercise solutions for
Verification of Sequential and Concurrent Programs. Krzysztof R. Apt, Frank S. de Boer, Ernst-R ¨udiger Olderog. Series: Texts in Computer Science. Springer. 3rd ed. 2nd Printing. ISBN: 978-1-84882-744-8
2.9 Exercises 2.1 i ( p ∨ ( q ∨ r ) ) ∧ ( q → ( r → p ) ) ≡ ( p ∨ ( q ∨ r ) ) ∧ ( q → ( ¬ r ∨ p ) ) ≡ ( p ∨ ( q ∨ r ) ) ∧ ( ¬ q ∨ ( ¬ r ∨ p ) ) ≡ ( p ∨ ( q ∨ r ) ) ∧ ( ¬ q ∨ ¬ r ∨ p ) ≡ ( p ∨ ( q ∨ r ) ) ∧ ( p ∨ ( ¬ q ∨ ¬ r ) ) ≡ p ∨ ( ( q ∨ r ) ∧ ( ¬ q ∨ ¬ r ) ) ii ( s < t ∨ s = t ) ∧ t < u ≡ s ≤ t ∧ t < u iii ∃ x : ( x < t ∧ ( p ∧ ( q ∧ r ) ) ) ∨ s = u ≡ ( ∃ x : x < t ∧ ( p ∧ ( q ∧ r ) ) ) ∨ s = u ≡ ( ( ∃ x : x < t ) ∧ ( p ∧ ( q ∧ r ) ) ) ∨ s = u ≡ ( ( ∃ x : x < t ) ∧ p ∧ q ∧ r ) ∨ s = u 2.2 i ( x + y ) [ x := z ] [ z := y ] ≡ ( z + y ) [ z := y ] ≡ y + y ii ( a [ x ] + y ) [ x := z ] [ a [ 2 ] := 1 ] ≡ ( a [ z ] + y ) [ a [ 2 ] := 1 ] ≡ if z [ a [ 2 ] := 1 ] = 2 then 1 else a [ z [ a [ 2 ] := 1 ] ] fi + y ≡ if z = 2 then 1 else a [ z ] fi + y iii a [ a [ 2 ] ] [ a [ 2 ] := 2 ] ≡ 2 2.3 i σ [ x := 0 ] ( a [ x ] ) = ( σ [ x := 0 ] ( a ) ) ( σ [ x := 0 ] ( x ) ) = σ ( a ) ( 0 ) = σ ( a [ 0 ] ) ii σ [ y := 0 ] ( a [ x ] ) = ( σ [ y := 0 ] ( a ) ) ( σ [ y := 0 ] ( x ) ) = σ ( a ) ( σ ( x ) ) = σ ( a [ x ] ) iii σ [ a [ 0 ] := 2 ] ( a [ x ] ) = σ [ a [ 0 ] := 2 ] ( a ) ( σ [ a [ 0 ] := 2 ] ( x ) ) = σ [ a [ 0 ] := 2 ] ( a ) ( σ ( x ) ) = { 2 if σ ( x ) = 0 , σ ( a [ x ] ) otherwise . iv τ [ a [ x ] := τ ( x ) ] ( a [ 1 ] ) = σ [ x := 1 ] [ a [ 1 ] := 2 ] [ a [ x ] := 1 ] ( a ) ( 1 ) = 1 2.4 i σ ⊨ p ∧ ( q ∧ r ) ⟺ ( σ ⊨ p ) ∧ ( σ ⊨ ( q ∧ r ) ) ⟺ ( σ ⊨ p ) ∧ ( ( σ ⊨ q ) ∧ ( σ ⊨ r ) ) ⟺ ( σ ⊨ p ) ∧ ( σ ⊨ q ) ∧ ( σ ⊨ r ) ⟺ ( σ ⊨ p ∧ q ) ∧ ( σ ⊨ r ) ⟺ σ ⊨ ( p ∧ q ) ∧ r ii σ ⊨ p ∨ ( q ∨ r ) ⟺ ( σ ⊨ p ) ∨ ( σ ⊨ q ) ∨ ( σ ⊨ r ) ⟺ ( σ ⊨ p ∨ q ) ∨ ( σ ⊨ r ) ⟺ σ ⊨ ( p ∨ q ) ∨ r iii σ ⊨ p ∨ ( q ∧ r ) ⟺ ( σ ⊨ p ) ∨ ( σ ⊨ ( q ∧ r ) ) ⟺ ( σ ⊨ p ) ∨ ( ( σ ⊨ q ) ∧ ( σ ⊨ r ) ) ⟺ ( ( σ ⊨ p ) ∨ ( σ ⊨ q ) ) ∧ ( ( σ ⊨ p ) ∨ ( σ ⊨ r ) ) ⟺ σ ⊨ ( p ∨ q ) ∧ ( p ∨ r ) iv Similar to the above.
v σ ⊨ ∃ x : ( p ∨ q ) ⟺ σ [ x := d ] ⊨ p ∨ q ⟺ ( σ [ x := d ] ⊨ p ) ∨ ( σ [ x := d ] ⊨ q ) ⟺ σ ⊨ ∃ x : p ∨ ∃ x : q vi Similar to the above.
2.5 i No. e.g. p ( x ) ≡ ( x = 0 ) , q ( x ) ≡ ( x = 1 )
L.H.S is always false, since x has to be 0 and 1 at the same time.
R.H.S is true, since p and q can use different x .
ii Similar to the above.
iii ( ∃ x : z = x + 1 ) [ z := x + 2 ] ≡ ( ∃ x : z = x + 1 ) [ x := y ] [ z := x + 2 ] ≡ ( ∃ y : z = y + 1 ) [ z := x + 2 ] ≡ ∃ y : x + 2 = y + 1 iv ( ∃ x : a [ s ] = x + 1 ) [ a [ s ] := x + 2 ] ≡ ( ∃ y : a [ s ] = y + 1 ) [ a [ s ] := x + 2 ] ≡ ∃ y : x + 2 = y + 1 2.6 i σ ⊨ ∀ x : p ⟹ { definition of ∀ } ∀ τ : σ = τ mod x ⟹ τ ⊨ p ⟹ { let τ = σ [ x := d ] , where d ∈ D T } ∀ d ∈ D T : σ [ x := d ] ⊨ p ∀ d ∈ D T : σ [ x := d ] ⊨ p ⟹ { suppose for any τ such that σ = τ mod x } ∀ τ : σ = τ mod x ⟹ τ ⊨ p ⟹ {definition of ∀ } σ ⊨ ∀ x : p ii Similar to the above.
2.7 i \llbracket ¬ p \rrbracket = {meaning of an assertion} { σ ∈ Σ ∣ σ ⊨ ¬ p } = {definition of negation} { σ ∈ Σ ∣ σ ⊨ p } c = {meaning of an assertion} Σ − { σ ∈ Σ ∣ σ ⊨ p } ii \llbracket p ∨ q \rrbracket = {meaning of an assertion} { σ ∣ σ ⊨ p ∨ q } = {definition of disjunction} { σ ∣ ( σ ⊨ p ) ∨ ( σ ⊨ q ) } = {for any τ in the set above, ( τ ⊨ p ) ∨ ( τ ⊨ q ) } { σ ∣ σ ⊨ p } ∪ { σ ∣ σ ⊨ q } = {meaning of an assertion} \llbracket p \rrbracket ∪ \llbracket q \rrbracket iii Similar to the above.
iv p → q ⟹ {for any τ ⊨ p , apply p → q } ( τ ⊨ p ) → ( τ ⊨ q ) ⟹ {definition of implication} τ ⊨ p → q ⟹ {summarize} τ ∈ { σ ∣ σ ⊨ p } → τ ∈ { σ ∣ σ ⊨ p → q } ⟹ {definition of subset} { σ ∣ σ ⊨ p } ⊆ { σ ∣ σ ⊨ p → q } ⟹ {meaning of an assertion} \llbracket p \rrbracket ⊆ \llbracket q \rrbracket v Similar to the above.
2.8 i Since both σ and τ agree on all variables in the expression s , the evaluated result must be the same.
ii Since both σ and τ agree on all free variables of p , the truth value of p under σ and τ must be the same. Therefore, σ ⊨ p if and only if τ ⊨ p .